﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="CounterpartyMaintan.aspx.cs" Inherits="CounterpartyMaintan" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p style="text-align: center">
        發行及保證機構代碼維護</p>
    <p style="text-align: center">
        <asp:Button ID="queryBtn" runat="server" onclick="queryBtn_Click" Text="查詢" />
&nbsp;
        <asp:Button ID="insertBtn" runat="server" onclick="insertBtn_Click" Text="新增" />
    </p>
    <p>
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
            AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
            DataKeyNames="id" DataSourceID="SqlDataSource1" ForeColor="#333333" 
            GridLines="None" onrowdeleted="GridView1_RowDeleted">
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="ItemCode" HeaderText="ItemCode" 
                    SortExpression="ItemCode" />
                <asp:BoundField DataField="ItemName" HeaderText="ItemName" 
                    SortExpression="ItemName" />
                <asp:BoundField DataField="ItemMemo" HeaderText="ItemMemo" 
                    SortExpression="ItemMemo" />
            </Columns>
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <EmptyDataTemplate>
                目前無相關設定資料
            </EmptyDataTemplate>
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FEIBConnectionString %>" 
            DeleteCommand="DELETE FROM [TR_ItemList] WHERE [id] = @id" 
            InsertCommand="INSERT INTO [TR_ItemList] ([ItemType], [ItemCode], [ItemName], [ItemMemo]) VALUES (@ItemType, @ItemCode, @ItemName, @ItemMemo)" 
            SelectCommand="SELECT * FROM [TR_ItemList] WHERE ([ItemType] = @ItemType)" 
            UpdateCommand="UPDATE [TR_ItemList] SET [ItemType] = @ItemType, [ItemCode] = @ItemCode, [ItemName] = @ItemName, [ItemMemo] = @ItemMemo WHERE [id] = @id">
            <SelectParameters>
                <asp:Parameter DefaultValue="CptyType" Name="ItemType" Type="String" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ItemType" Type="String" />
                <asp:Parameter Name="ItemCode" Type="String" />
                <asp:Parameter Name="ItemName" Type="String" />
                <asp:Parameter Name="ItemMemo" Type="String" />
                <asp:Parameter Name="id" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ItemType" Type="String" />
                <asp:Parameter Name="ItemCode" Type="String" />
                <asp:Parameter Name="ItemName" Type="String" />
                <asp:Parameter Name="ItemMemo" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    </p>
    <p>
        <asp:FormView ID="FormView1" runat="server" CellPadding="4" DataKeyNames="id" 
            DataSourceID="SqlDataSource2" DefaultMode="Insert" ForeColor="#333333" 
            ondatabound="FormView1_DataBound" onitemcommand="FormView1_ItemCommand">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <EditItemTemplate>
                id:
                <asp:Label ID="idLabel1" runat="server" Text='<%# Eval("id") %>' />
                <br />
                ItemType:
                <asp:TextBox ID="ItemTypeTextBox" runat="server" 
                    Text='<%# Bind("ItemType") %>' />
                <br />
                ItemCode:
                <asp:TextBox ID="ItemCodeTextBox" runat="server" 
                    Text='<%# Bind("ItemCode") %>' />
                <br />
                ItemName:
                <asp:TextBox ID="ItemNameTextBox" runat="server" 
                    Text='<%# Bind("ItemName") %>' />
                <br />
                ItemMemo:
                <asp:TextBox ID="ItemMemoTextBox" runat="server" 
                    Text='<%# Bind("ItemMemo") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="更新" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="取消" />
            </EditItemTemplate>
            <InsertItemTemplate>
                ItemType:
                <asp:TextBox ID="ItemTypeTextBox" runat="server" 
                    Text='<%# Bind("ItemType") %>' />
                <br />
                ItemCode:
                <asp:TextBox ID="ItemCodeTextBox" runat="server" 
                    Text='<%# Bind("ItemCode") %>' />
                <br />
                ItemName:
                <asp:TextBox ID="ItemNameTextBox" runat="server" 
                    Text='<%# Bind("ItemName") %>' />
                <br />
                ItemMemo:
                <asp:TextBox ID="ItemMemoTextBox" runat="server" 
                    Text='<%# Bind("ItemMemo") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="插入" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="取消" />
            </InsertItemTemplate>
            <ItemTemplate>
                id:
                <asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>' />
                <br />
                ItemType:
                <asp:Label ID="ItemTypeLabel" runat="server" Text='<%# Bind("ItemType") %>' />
                <br />
                ItemCode:
                <asp:Label ID="ItemCodeLabel" runat="server" Text='<%# Bind("ItemCode") %>' />
                <br />
                ItemName:
                <asp:Label ID="ItemNameLabel" runat="server" Text='<%# Bind("ItemName") %>' />
                <br />
                ItemMemo:
                <asp:Label ID="ItemMemoLabel" runat="server" Text='<%# Bind("ItemMemo") %>' />
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="編輯" />
                &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="刪除" />
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                    CommandName="New" Text="新增" />
            </ItemTemplate>
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <EditRowStyle BackColor="#999999" />
        </asp:FormView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FEIBConnectionString %>" 
            DeleteCommand="DELETE FROM [TR_ItemList] WHERE [id] = @id" 
            InsertCommand="INSERT INTO [TR_ItemList] ([ItemType], [ItemCode], [ItemName], [ItemMemo]) VALUES (@ItemType, @ItemCode, @ItemName, @ItemMemo)" 
            SelectCommand="SELECT * FROM [TR_ItemList]" 
            UpdateCommand="UPDATE [TR_ItemList] SET [ItemType] = @ItemType, [ItemCode] = @ItemCode, [ItemName] = @ItemName, [ItemMemo] = @ItemMemo WHERE [id] = @id">
            <DeleteParameters>
                <asp:Parameter Name="id" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="ItemType" Type="String" />
                <asp:Parameter Name="ItemCode" Type="String" />
                <asp:Parameter Name="ItemName" Type="String" />
                <asp:Parameter Name="ItemMemo" Type="String" />
                <asp:Parameter Name="id" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="ItemType" Type="String" />
                <asp:Parameter Name="ItemCode" Type="String" />
                <asp:Parameter Name="ItemName" Type="String" />
                <asp:Parameter Name="ItemMemo" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    </p>
</asp:Content>

